package com.czl.base.data.bean.tengyun

import java.math.BigDecimal

/**
 * @author by xubin
 * PS: Not easy to write code, please indicate.
 */
class FacilityBean(
    var id: Long? = null,
    var facilitySum: Int? = null,
    var categoryId: String? = null,
    var classificationId: String? = null,
    var facilityName: String? = null,
    var parentId: String? = null,
    var locationNo: String? = null,
    var spaceNo: String? = null,
    var spaceId: Long? = null,
    var spacePos: Int? = null,
    var locationDesc: String? = null,
    var model: String? = null,
    var producer: String? = null,
    var maintenanceDate: String? = null,
    var installDate: String? = null,
    var startDate: String? = null,
    var uselessDate: String? = null,
    var price: String? = null,
    var newPrice: String? = null,
    var depreciationPrice: String? = null,
    var depreciation: String? = null,
    var supply: String? = null,
    var companyId: String? = null,
    var projectId: String? = null,
    var projectName: String? = null,
    var extprop: String? = null,
    var ismeter: Byte? = null,
    var isEnable: String? = null,
    var gmtCreate: String? = null,
    var gmtModify: String? = null,
    var productNo: String? = null,
    var maintenanceCompnay: String? = null,
    var facilityNo: String? = null,
//"设施状态,0在用,1闲置,2报废,3保养,4待修,5在修，6迁移，7待报废,8变卖,9借出,10库存,11未用,12盘亏,13出租,14 出售,15投资,16划拨,17捐赠 ,18清理")
    var status: Int? = null,
    var parentNo: String? = null,
    var latlng: String? = null,
    var lastValue: String? = null,
    var roomId: String? = null,
    var positionRoomId: String? = null,
    var buildId: String? = null,
    var storeyId: String? = null,
    var qqnumber: String? = null,
    var wxnumber: String? = null,
    var oldprice: String? = null,
    var workinglife: String? = null,
    var paraext: String? = null,
    var mark: String? = null,
    var gainDate: String? = null,
    var gainMethod: Int? = null,
    var useMethod: Byte? = null,
    var depreciationMethod: Byte? = null,
    var depreciationMonth: String? = null,
    var facilityPrepareId: Long? = null,
    var manageCompanyId: Int? = null,
    var manageOrgId: Int? = null,
    var manageUserId: Long? = null,
    var isHide: Int? = null,
    var contractId: Int? = null,
    var contractName: String? = null,
    var engineeringId: Int? = null,
    var engineeringType: Byte? = null,
    var engineeringName: String? = null,
    var engineeringFinalNo: String? = null,
    var unit: String? = null,
    var brand: String? = null,
    var insuranceNo: String? = null,
    var picUrl: String? = null,
    var oldPriceRatio: String? = null,
    var isTemp: Byte? = null,
    var deviceClassId: Long? = null,
    var historyRecord: String? = null,
    var isStartLoss: Byte? = null,
    var nextCalculateDate: String? = null,
    var nextCalculateValue: BigDecimal? = null,
    var classificationCode: String? = null,
    var thisValue: BigDecimal? = null,
    var classificationName: String? = null,
    var isIndoor: Byte? = null,
    var qqGpsPoint: String? = null,
    var cardNo: String? = null,
    var inventoryResult: Int? = null,
    var ownershipCompanyList: MutableList<OwnerCompanyBean>? = null,
    var position: Int? = null,
    var taskId: Int? = null,
    var inventoryId: String? = null,
    var imgList: MutableList<FileBean>? = null,
    var planInventoryMethodList: MutableList<Int>? = null,
) {
    companion object {

        //盘亏
        const val TYPE_DEFICIT = -1

        //正常
        const val TYPE_NORMAL = 0

        //盘盈
        const val TYPE_PANYING = 1

        //默认
        const val TYPE_DEFAULT = 2

        //未知状态
        const val TYPE_UNKNOWN = 3

        //盘亏
        const val RESULT_DEFICIT = -1

        //正常
        const val RESULT_NORMAL = 0

        //盘盈
        const val RESULT_PANYING = 1

        fun getInventoryNum(list: List<FacilityBean>?): Int {
            if (list == null) {
                return 0
            }
            var total = 0
            for (bean in list) {
                if (bean.inventoryResult != null) {
                    total++
                }
            }
            return total
        }
    }
}

class OwnerCompanyBean {
    var companyId: String? = null
    var companyName: String? = null
    var companyRatio: String? = null
    var companyShortName: String? = null
}

class InventoryAssetBean(
    var facilityId: Int? = null,
    var facilityNo: String = "",
    var facilityName: String? = null,
    var facilityStatus: Int? = null,
    var facilityStatusName: String? = null,
    var addressName: String = "",
    var classificationId: Int? = null,
    var execId: String? = null,
    var gainDate: String? = null,
    var imgList: MutableList<FileBean>? = null,
    var imgUrl: String? = null,
    var inventoryId: String? = null,
    var inventoryType: Int? = null,
    val taskName: String? = null,
    val taskId: Long? = null,
    val endTime: String? = null,
    val isCheck: Int? = null,
    val planId: String? = null,
    var planInventoryMethodList: MutableList<Int>? = null,
    val startTime: String? = null,
    val hasInventoryCount: Int? = null,
    val inventoryCount: Int? = null,
    val isTask: Int? = null,
    val unInventoryCount: Int? = null,
    var status: Int? = null,
    var orgName: String = "",
    var orgId: Int? = null,
    var position: Int? = null,
    var mark: String? = null,
    var isReplace: Int? = null,
    var locationDesc: String = ""
) {
    fun getStateName(): String {
        return when (status) {
            null -> {
                ""
            }
            0 -> {
                "未开始"
            }
            1 -> {
                "已完成"
            }
            2 -> {
                "盘点中"
            }
            else -> {
                ""
            }
        }
    }

    fun getInventoryTime(): String {
        return if (startTime == null && endTime == null) {
            ""
        } else if (startTime == null) {
            endTime!!
        } else if (endTime == null) {
            startTime
        } else {
            startTime + "到" + endTime
        }
    }
}

data class InventoryAssetCountBean(
    val `0`: Int,
    val `1`: Int,
    val `2`: Int,
    val `3`: Int
)
